import React, { Component } from 'react';
import {
    AppRegistry,
    Image,
    PixelRatio,
    ScrollView,
    Text,
    View,
    Button,
    TouchableOpacity
} from 'react-native';
import resolveAssetSource from 'resolveAssetSource'; 
import Picker from 'react-native-picker';
import ImagePicker from 'react-native-image-picker';
import ProgressBar from 'ProgressBarAndroid';

import Head from './layout/Head';
import styles from '../../assets/css/style.js';
import GlobalConfig from '../util/Global';

import Heatmap from './Heatmap/Heatmap';

const rem = GlobalConfig.WIDTH/7.5;
const her = (GlobalConfig.HEIGHT-1.92*rem);

/**
 * 状态查看
 */
export default class CoverTest extends Component {
    constructor(props){
        super(props);
        this.state={
            language:"请选择房型",
            isPickerShow: false
        }
    }

    componentWillMount() {
        setTimeout(
            () => {

                let width = 5.3 * rem;
                let height = 8.44 * rem;
                let icon =  require('../../assets/img/w.png'); 
                let source = resolveAssetSource(icon);

                let imgSourceWidth = source.width;
                let imgSourceHeight = source.height;

                let finalWidth, finalHeight;
                let tempRate = 1.0 * imgSourceHeight / imgSourceWidth;
                if (tempRate - 1 > 0) {
                    finalHeight = height;
                    finalWidth = height / tempRate;
                } else {
                    finalWidth = width;
                    finalHeight = width * tempRate;
                }
                
                this.setState({finalHeight, finalWidth});
            });
  }


    render() {
        // const {navigate} = this.props.navigation;
        // const { params } = this.props.navigation.state;

        const lists=[["首 页", "icon_in", GlobalConfig.LOGIN_VIEW], 
                     ["状态查看", "icon_ck", GlobalConfig.STATUS_CHECK_VIEW], 
                     ["设 置", "icon_sz", GlobalConfig.SETTING_VIEW]];
        return (
            <View style={[styles.flex,styles.bgcolor]}>
                <Head title="测试功能" list={lists} > </Head>
                
                <View style={styles.flex}>
                    <ScrollView style={styles.ztScroll}>
                        <View style={styles.Iptop}>
                            <View style={styles.IpPick}>
                                <Text style={styles.PickText}>
                                    {/* {params.roomType} */}
                                </Text>
                            </View>
                        </View>
                        <View style={[styles.center]}>
                            <View style={styles.Ipwrap}>
                                
                                <Image
                                    style={styles.Ip_Bgimg}
                                    resizeMode="contain"
                                    source={require('../../assets/img/bg_Ipt.png')}
                                />


{
    /*
     <Image
     style={styles.Ip_Bg}
     resizeMode="contain"
     source={require('../../assets/img/bg_sp.png')}
     />*/
}

                            </View>
                            <View style={[styles.CPBut]}>
                                <Text style={styles.CPButFont}>生成报告</Text>
                            </View>
                        </View>
                    </ScrollView>
                </View>
                {/*<View style={[styles.CesProcess, {display: 'none'}]}>*/}
                 <View style={[styles.CesProcess,{display:"none"}]}>
                    <ScrollView style={[styles.ztScroll]}>
                        <View style={styles.CPTop}>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>响应时长：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>连接时间延迟：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>传输时间延迟：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>接收信号强度：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>连接速率：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>平均上行速度：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={styles.CPList}>
                                <Text style={styles.CPFont}>平均下行速率：</Text>
                                <Text style={styles.CPFontMon}>20s</Text>
                            </View>
                            <View style={[styles.CPList,styles.center]}>
                                {/*<Image
                                    style={styles.CPImg}
                                    resizeMode="contain"
                                    source={require('../../assets/img/load.gif')}
                                />*/}
                                <ProgressBar style={styles.CPImg} progress={0.2} styleAttr="Inverse" />
                            </View>
                            <View style={styles.CPList}>
                                <View style={styles.CPBut}>
                                    <Text style={styles.CPButFont}>确  认</Text>
                                </View>
                            </View>
                            <View style={styles.CPList}>
                                 <Text style={styles.CPButFont}>请确定所在房间与测点相同</Text>
                            </View>
                        </View>
                    </ScrollView>
                </View>
            </View>
        );
    }
}